package com.srd.phone.activity;

import android.content.Intent;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;

import com.shengrongdai.srd.R;
import com.srd.phone.utils.Constants;
import com.srd.phone.utils.PreferenceUtils;

/**
 * 密码管理
 */
public class SafePasswordManageActivity extends BaseActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_safe_password_manage);
        initView();
    }

    @Override
    public void initView() {
        tv_common_title.setText("密码管理");
        findViewById(R.id.tv_update_login_pwd).setOnClickListener(this);
        findViewById(R.id.tv_update_trading_pwd).setOnClickListener(this);
        findViewById(R.id.tv_gesture_lock).setOnClickListener(this);
    }

    @Override
    public void initData() {}

    @Override
    public void onClick(View v) {
        switch (v.getId()) {
            case R.id.tv_update_login_pwd:
                gotoActivity(SafeUpdateLoginPwdActivity.class);  // 修改登录密码
                break;
            case R.id.tv_update_trading_pwd:  // 修改交易密码

                break;
            case R.id.tv_gesture_lock: // 手势密码
                if(!TextUtils.isEmpty(PreferenceUtils.getInstance().getData(Constants.GESTURE_LOCK_KEY, ""))){
                    Intent intent = new Intent(SafePasswordManageActivity.this, GestureUnLockActivity.class);
                    intent.putExtra("titleName", "请输入旧手势密码");
                    gotoActivity(intent);
                } else{
                    gotoActivity(InitGestureLockActivity.class);
                }
                break;
        }
    }
}
